

#set(CUDA_TOOLKIT_ROOT_DIR /usr/local/cuda-10.2)
#
#message(STATUS "CUDA library status:")
#message(STATUS "    version: ${CUDA_VERSION}")
#message(STATUS "    include path: ${CUDA_INCLUDE_DIRS}")
#message(STATUS "    libraries: ${CUDA_LIBRARIES}")
#
#find_package(OpenCV REQUIRED)
#message(STATUS "OpenCV library status:")
#message(STATUS "    version: ${OpenCV_VERSION}")
#message(STATUS "    libraries: ${OpenCV_LIBS}")
#message(STATUS "    include path: ${OpenCV_INCLUDE_DIRS}")

if(BUILD_INT8)
    add_definitions(-DUSE_INT8)
    message("Build Engine as INT8")
    message("INT8_CALIBRATE_DATASET_PATH: " ${INT8_CALIBRATE_DATASET_PATH})
    configure_file(${SOLUTION_DIR}/include/fastrt/config.h.in ${SOLUTION_DIR}/include/fastrt/config.h @ONLY)
elseif(BUILD_FP16)
    add_definitions(-DUSE_FP16)
    message("Build Engine as FP16")
else()
    message("Build Engine as FP32")
endif()

# cuda
include_directories(${CUDA_INCLUDE_DIRS})
link_directories(/usr/local/lib)
link_directories(/usr/local/lib64)

# tensorrt
include_directories(${TRT_ROOT_DIR}/include)
link_directories(${TRT_ROOT_DIR}/lib)

# opencv
include_directories(${OpenCV_INCLUDE_DIRS})

# osnetreid
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/osnetreid)
include_directories(${SOLUTION_DIR})

file(GLOB_RECURSE OSNETREID_SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/osnetreid/*.cpp)

cuda_add_library(${OSREID} SHARED ${OSNETREID_SOURCE})

target_link_libraries(${OSREID} ${OpenCV_LIBS}
        nvinfer nvinfer_plugin nvonnxparser nvparsers)

install(TARGETS ${OSREID}
        LIBRARY DESTINATION ${SOLUTION_DIR}/libs/${PROJECT_NAME})